<!DOCTYPE html>
<html>
<head>
  <title>添加管理</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="bootstrap4/css/bootstrap.min.css">
  <link rel="stylesheet" href="css2/style2.css"> 
  <script src="http://static.runoob.com/assets/jquery-validation-1.14.0/lib/jquery.js"></script>
  <script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script>
  <script src="js2/my.js"></script>
</head>

<script type="text/javascript">
$(function(){
	$("#formID").validate({
        rules: {
            "setName": {
                required: true
            },
            "commandName":{
                required:true
            }
        },
        messages:{
            "setName":{
                required:"设置名称不能为空"
            },
            "commandName":{
                required:"指令名称不能为空"
            }
        },
        submitHandler:function(form){
        	$.ajax({
        		type: "POST",//方法类型
                dataType: "json",//预期服务器返回的数据类型
                url: "setInfo/saveSetInfo" ,//url
                data: $('#formID').serialize(),
                success: function (result) {
                    console.log(result);//打印服务端返回的数据(调试用)
                    if (result.code == 200) {
                        if(confirm(result.msg+'是否继续？？'))
                        {   
                        	 window.location.href = "setInfo/addSetInfo";
                        }
                        else
                        {  
                        	 window.location.href = "setInfo/queryForSetInfoList";
                        }
                    }
                    else{                	
                    	alert(result.msg);
                    }
                     
                },
                error : function() {
                    alert("异常！");
                }
            });
        },
        //自定义错误样式
        errorClass:"text-danger",
        //未通过验证,进行高亮处理或其他处理；
        highlight:function(input){
            $(input).closest(".form-group").addClass("has-error");
        },
        //通过验证,清除高亮效果或其他处理；
        unhighlight:function(input){
            $(input).closest(".form-group").removeClass("has-error");
        }
	});
}); 
</script>
<body>
<div class="header-area" id="headerArea">
   <div class="container h-100 d-flex align-items-center justify-content-between">
 
     <div class="logo-wrapper">
     <a th:href="@{/setInfo/queryForSetInfoList}"> 返回 </a>
	 </div>
     <!-- Search Form-->
     <div class="top-search-form">
     	 添加管理
     </div>
     <div  id="suhaNavbarToggler"><span></span><span></span><span></span></div>
   </div>
 </div>

<div class="container mt60">
  <form id="formID"  >
  	<input type="hidden" name="commandId" th:value="${commandInfoVO?.commandId}" /> 
    <div class="form-group">
       <div class="single-payment-method"> 
       		<img class="mb-3" src="img/bg-img/8.jpeg"   width="100%"alt="">
       </div>
    </div>
    <div class="form-group"> 
      <label class="title fl"></label>
      <label for="setName" class="fl" >设置姓名:</label>
      <input type="text" class="form-control" id="setName" placeholder="请填写设置姓名" 
      name="setName"
      th:value="${setInfoVO?.setName}" >
    </div>
    
    <div style="float:left;margin-bottom:20px;margin-left:20px;">
				<input class="easyui-textbox wd50" type="text" data-options="required:true"
					th:label="#{setInfo.setName}+'  :'" label="设置姓名"
					th:prompt="'请填写'+#{setInfo.setName}" prompt="请填写设置姓名"
					name="setName" th:value="${setInfoVO?.setName}" /> 
			</div>
    
     <div class="form-group"> 
      <label class="title fl"></label>
      <label for="commandName" class="fl" >指令名称:</label>
      <input type="text" class="form-control" id="commandName" placeholder="请填写指令名称" 
      name="commandName"
      th:value="${commandInfoVO?.commandName}" >
    </div> 
     <button type="submit" class="btn btn-primary btn-block" >提交</button>
  </form>
 
</div>

</body>
</html>
   




	<form th:id="${formID}" th:action="@{/set/setInfo/saveSetInfo}"  method="post" enctype="multipart/form-data">  
			<input type="hidden" name="setId" th:value="${setInfoVO?.setId}" /> 
		<div>

			
			<br style="clear:both;">
			<div style="float:left;margin-bottom:20px;margin-left:20px;">
				<input class="easyui-textbox wd50" type="text" data-options="required:true"
					th:label="#{setInfo.setUrl}+'  :'" label="设置地址"
					th:prompt="'请填写'+#{setInfo.setUrl}" prompt="请填写设置地址"
					name="setUrl" th:value="${setInfoVO?.setUrl}" /> 
			</div>
			<br style="clear:both;">
			<div style="float:left;margin-bottom:20px;margin-left:20px;">
				<input class="easyui-textbox wd50" type="text" data-options="required:true"
					th:label="#{setInfo.setStatus}+'  :'" label="设置状态"
					th:prompt="'请填写'+#{setInfo.setStatus}" prompt="请填写设置状态"
					name="setStatus" th:value="${setInfoVO?.setStatus}" /> 
			</div>
			<br style="clear:both;">
			<div style="float:left;margin-bottom:20px;margin-left:20px;">
				<input class="easyui-textbox wd50" type="text" data-options="required:true"
					th:label="#{setInfo.setSort}+'  :'" label="机构排序"
					th:prompt="'请填写'+#{setInfo.setSort}" prompt="请填写机构排序"
					name="setSort" th:value="${setInfoVO?.setSort}" /> 
			</div>
			<br style="clear:both;">
			<div style="float:left;margin-bottom:20px;margin-left:20px;">
				<input class="easyui-textbox wd50" type="text" data-options="required:true"
					th:label="#{setInfo.setPic}+'  :'" label="设置图标"
					th:prompt="'请填写'+#{setInfo.setPic}" prompt="请填写设置图标"
					name="setPic" th:value="${setInfoVO?.setPic}" /> 
			</div>
			<br style="clear:both;">
		</div>
	</form> 
	  
